import 'package:flutter/material.dart';

class PosterIndex extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('电影海报')),
      body: gridView1(),
    );
  }

  gridView1() {
    return GridView(gridDelegate:
        SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisCount: 3,
          crossAxisSpacing: 10,
          mainAxisSpacing: 10,
          childAspectRatio: 0.5,
        ),
      padding: EdgeInsets.all(10),
      children: _children(),
    );
  }

  gridView2() {
    return GridView.count(
      crossAxisCount: 3,
      padding: EdgeInsets.all(10),
      crossAxisSpacing: 10,
      mainAxisSpacing: 10,
      childAspectRatio: 0.5,
      children:_children(),
    );
  }

  List<Widget> _children(){
    return  [
      _image('http://img5.mtime.cn/mt/2021/08/23/092203.37762105_1280X720X2.jpg'),
      _image('http://img5.mtime.cn/mt/2021/08/28/182243.62990222_1280X720X2.jpg'),
      _image('http://img5.mtime.cn/mt/2021/07/24/165813.84531124_1280X720X2.jpg'),
      _image('http://img5.mtime.cn/mt/2021/08/10/211436.32159184_1280X720X2.jpg'),
      _image('http://img5.mtime.cn/mt/2021/08/13/151826.16349443_1280X720X2.jpg'),
      _image('http://img5.mtime.cn/mt/2020/09/30/141106.85851878_1280X720X2.jpg'),
      _image('http://img5.mtime.cn/mt/2021/07/29/105930.62452571_1280X720X2.jpg'),
      _image('http://img5.mtime.cn/mt/2021/08/25/132019.79122298_1280X720X2.jpg'),
      _image('http://img5.mtime.cn/mt/2021/08/26/111945.60146140_1280X720X2.jpg'),
      _image('http://img5.mtime.cn/mt/2021/08/16/143848.18683507_1280X720X2.jpg'),
      _image('http://img5.mtime.cn/mt/2021/07/23/161851.14329984_1280X720X2.jpg'),
      _image('http://img5.mtime.cn/mt/2021/06/23/144247.59352538_1280X720X2.jpg'),



    ];
  }
  
  _image(String src){
    return Image.network(src,fit:BoxFit.cover);
  }
}


